<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="utils.js">

		</script>
	</head>
	<body>
		<button id="btn1">点击改变颜色</button>
		<button id="btn">停止定时器</button>
		<script type="text/javascript">
			var timer = setInterval(function() {
				document.body.style.background = randomColor()
			}, 500)
			//给定时器添加停止事件
			btn.onclick = function() {
				//改变背景颜色的定时器名字为timer
				clearInterval(timer)

			}
		</script>
	</body>
</html>
